//
//  HBQHomeViewController.m
//  HelloBeeQuick
//
//  Created by LiYiLin on 16/8/18.
//  Copyright © 2016年 LiYiLin. All rights reserved.
//

#import "HBQHomeViewController.h"
#import "HBQHomeHeaderView.h"
#import <Masonry/Masonry.h>

#define kHeaderH (160)

static NSString *identifier = @"homeCell";

@interface HBQHomeViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView  * tableView;
@property (nonatomic, strong) UIScrollView * scrollView;


@end

@implementation HBQHomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setup_Home];
    [self setup_Layout];
}

#pragma mark - 配置主页界面 -
- (void)setup_Home {

    [self.view addSubview:self.tableView];

    self.navigationController.navigationBar.barTintColor = KTHEMES;
    self.navigationController.navigationBar.translucent = NO;
}

- (void)setup_Layout {

    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.bottom.right.mas_equalTo(self.view);
    }];
}

- (void)dealloc {

    self.tableView = nil;
}

#pragma mark - 懒加载控件 -
- (UITableView *)tableView {

    if (!_tableView) {
        _tableView = [[UITableView alloc] init];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.tableHeaderView = [[HBQHomeHeaderView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, kHeaderH)];
        [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:identifier];
    }
    return _tableView;
}

#pragma mark - tableViewDelegate,tableViewDateSource -
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return 30;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];
    
    
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier];
    }
    
    cell.detailTextLabel.text = @"123";
    cell.textLabel.text = @"23454637890";
    
    return cell;
}


@end












